home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Communications
/
General
/
LineShare Folder
/
Put Onto Productions Disks
/
LineShare Scripts
/
Generic Fax2&ARA
< prev
next >
Wrap
Text File
|
1993-12-12
|
6KB
|
270 lines
! Version 2.1
!
!$ Requires: Class 2 fax modem, hardware handshaking cable.
!$ Supports: fax and ARA software in the server mode.
!$ Use: Class 2 for Fax, ARA/LineShare for ARA.
!$ Read: your modem manual to modify the "AT" strings.
!$ See: the Generic Scripts Guide for details.
^2 Speaker On: = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Fax Identifier: = Text "Stalker_GmbH"
^6 AT for Normal mode: = Text ""
^7 AT for HW Handshake: = Text ""
^8 AT for SW Handshake: = Text ""
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
Write "+++"
DtrClear
LBreak
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
SetVar A ""
IfStr A 50 "^6^7^8"
@Label 10
!
! Set the modem preferred speed first
!
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • Normal connection (for ARA), report DCE speed
! • HW flow control (for ARA, Fax should not use a handshake on receiving)
Write "AT^7^6\r"
Jsr 100
!
! Set Fax parameters: LID, DCC,BOR
!
Write "AT+FCLASS=2\r"
Jsr 100
Write "AT+FLID=\"^5\"\r"
Jsr 100
Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
Jsr 100
Write "AT+FBOR=1\r"
Jsr 100
Write "AT+FCR=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4+FAA=1\r"
Jsr 100
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
Note "Waiting for a fax or ARA call…"
@Label 15
MatchClr
matchstr 1 16 "RING\r\n"
matchstr 2 20 "\r\nCARRIER "
matchstr 3 20 "\r\nCONNECT "
matchstr 5 30 "\r\n+FCON"
matchstr 6 10 "\r\nNO "
matchstr 7 10 "\r\nBUSY"
Matchread 1200
jump 10
@Label 16
Note "Ring…"
jump 15
!
! Data connection has been established (we read "CARRIER" or "CONNECT ")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 20
QueueInput "\r\nCARRIER "
ifOriginate 21
QueueInput "\r\nRING\r\n"
@Label 21
Attach "ARA" (DTR,Escape,TimeLimit=0)
!
! Fax connection has been established (we read "+FCON")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 30
QueueInput "\r\n+FCON"
ifOriginate 31
QueueInput "\r\nRING\r\n"
@Label 31
Attach "Fax" (DTR,Reset,Escape,IdleLimit=30)
@Label 50
Note "Suspended"
Say "Press the Options… button to enter the AT-strings for your modem!"
Pause 1200
Jump 50
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • Normal connection (no compression, correction - for ARA), report DCE rate
! • HW Handshake
! • S7: time-out (90 sec) for long-distance call (if you use them)
!
Write "AT^7^6S7=90\r"
Jsr 100
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 20 "\r\nCARRIER "
MatchStr 2 20 "\r\nCONNECT "
MatchRead 1000
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
!
! Set the "Fax" speed
!
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! • Xon/Xoff handshake
! • DSR always on
!
Write "AT&S0^8+FCLASS=2\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
!
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 30 "\r\n+FCON"
MatchRead 1000
Write "\r"
Exit -6019
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! extended responses + speaker control +
! command mode on Dtr drop + DCD valid
! Verbal responses mode, no echo
!
@Label 70
Write "ATX4M^2L^3&D2&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes, send the dialing command and
! set the user's handshake mode
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return